var webpack = require('webpack');

var path = require('path');




var ExtractTextPlugin = require("extract-text-webpack-plugin");

module.exports = {
    debug: true,
    entry: {
        index: './main'
    },
    output: {
        path: path.join(__dirname, 'dist'),
        publicPath: '',
        filename: "bundle.js"
    }, //页面引用的文件
 
    module: {
        loaders: [
        {
          test: /\.json$/,
          loader: 'json'
        },
        // {
        //     test: /\.html$/,
        //     loader: "text"
        // },
        {
            test: /\.css$/,
            loader: "style!css"
        }, {
          test: /\.(jpg|png|gif)$/,
          loader: "file-loader?name=images/[name].[hash].[ext]"
        },
          {test: /\.scss$/, loader:ExtractTextPlugin.extract('css!sass')},

          {test: /\.(ttf|eot|svg|woff2?)((\?|#)[^\'\"]+)?$/, loader: 'file-loader?name=[name].[ext]'}

        ]
    },
    plugins: [ 
        new webpack.HotModuleReplacementPlugin(),
        new ExtractTextPlugin("styles.css")
    ],
    resolve: {
        root: path.resolve('.'),

        // require时省略的扩展名，如：require('module') 不需要module.js
        extension: ['', '.js', '.css','.less',".coffee","json"],
         alias: {

             avalon: path.join(__dirname, "node_modules/avalon2/dist/avalon")
        }
    },
    devtool: '#source-map'
    // devtoolModuleFilenameTemplate: '[resourcePath]',
    // devtoolFallbackModuleFilenameTemplate: '[resourcePath]?[hash]'
}
